﻿<Page x:Class="TFSUtils.View.MainView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:TFSUtils.View"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      DataContext="{Binding Main, Source={StaticResource Locator}}"
      Title="MainView">

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>            
        </Grid.RowDefinitions>
        
        <!--
        <Image Grid.Row="0" Grid.RowSpan="8" Opacity="0.5" Source="Content/Wait.png" Panel.ZIndex="1" 
               Visibility="{Binding BusyConverter}" />
        -->

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0">TFS URI : </TextBlock>
            <ComboBox Grid.Column="1" Text="{Binding Path=TFSUri}" ItemsSource="{Binding TFSUriHistory}"
                      IsEditable="True"/>
        </Grid>
        <ListBox Grid.Column="0" Grid.Row="1" ItemsSource="{Binding Status}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="{Binding DateStamp, StringFormat=d}" />
                        <TextBlock Grid.Column="1">
                            <Run Text=" " />
                            <Run Text="{Binding Description}" />
                        </TextBlock>
                        <TextBlock Grid.Column="2" Text="{Binding ItemType}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <Button Command="{Binding ValidateUriCommand}" Content="Validate URI" 
                Grid.Column="0" Grid.Row="2" ToolTip="Validate URI" 
                AutomationProperties.AutomationId="cmdValidateUri"/>

        <Button Command="{Binding FindOrphanedWorkspaceCommand}" Content="Find Orphaned Workspaces" 
                Grid.Column="0" Grid.Row="4" ToolTip="Locate workspaces that have no pending changes"/>
        <Button Command="{Binding CleanWorkspaceCommand}" Content="Clean Workspaces" 
                Grid.Column="0" Grid.Row="5" ToolTip="Clean / delete workspaces found with no pending changes"/>
        
        <Button Command="{Binding ShowCheckoutStatusCommand}" Content="Show Checkouts" 
                Grid.Column="0" Grid.Row="7" ToolTip="Display currently checked out code"/>        
        <Button Command="{Binding ShowWorkItemsInBuildCommand}" Content="Build Analysis" 
                Grid.Column="0" Grid.Row="9" ToolTip="Display a list of workitems associated with a build"
                AutomationProperties.AutomationId="cmdBuildAnalysis"/>
        
    </Grid>
</Page>
